﻿<customWindow:BlackStyleChildWindow x:Class="MediaBrowserSL.RIA.Views.ChildWindowAdminMovies"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:customWindow="http://www.sebastien-alves.fr/jadeToolsSLWindows" 
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:jadeControls="http://www.sebastien-alves.fr/jadeToolsSLControls" 
           xmlns:eventToCmd="clr-namespace:JulMar.Siverlight.Helpers.Interactivity;assembly=JulMar.Siverlight.Helpers"
           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
           xmlns:bindingHelpers="clr-namespace:JulMar.Siverlight.Helpers.BindingHelpers;assembly=JulMar.Siverlight.Helpers"
           Title="Ajouter/Modifier un film">

    <controls:ChildWindow.DataContext>
        <Binding Mode="OneWay" Path="ManageMovies" Source="{StaticResource Locator}"/>
    </controls:ChildWindow.DataContext>

    <Grid Background="{StaticResource BckWindow}">
        
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Margin="5,15,5,5">
            <Grid.RowDefinitions>
                <RowDefinition Height="22"/>
                <RowDefinition Height="5" />
                <RowDefinition Height="200" />
                <RowDefinition Height="5" />
                <RowDefinition Height="22" />
                <RowDefinition Height="5" />
                <RowDefinition Height="210" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="350"/>
            </Grid.ColumnDefinitions>

            <sdk:Label Grid.Column="0" Grid.Row="0"  Content="Nom : "/>
            <sdk:Label Grid.Column="0" Grid.Row="2"  Content="Description : "/>
            <sdk:Label Grid.Column="0" Grid.Row="4"  Content="Fichier Video : "/>
            <sdk:Label Grid.Column="0" Grid.Row="6"  Content="Affiche : "/>

            <TextBox x:Name="name" Grid.Column="1" Grid.Row="0" Width="200" HorizontalAlignment="Left"
                             Text="{Binding NewMedia.Name, Mode=TwoWay,ValidatesOnDataErrors=True}" bindingHelpers:BindingTextHelper.UpdateSourceOnChange="True">
            </TextBox>
            <TextBox Grid.Column="1" Grid.Row="2" TextWrapping="Wrap"
		                             VerticalScrollBarVisibility="Visible" AcceptsReturn="True" 
                                    Text="{Binding NewMedia.Description, Mode=TwoWay,ValidatesOnDataErrors=True}" bindingHelpers:BindingTextHelper.UpdateSourceOnChange="True">
                <TextBox.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFD1D4D6" Offset="0"/>
                        <GradientStop Color="White" Offset="0.803"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </TextBox.Background>
            </TextBox>
            
            <StackPanel Grid.Column="1" Grid.Row="4" Orientation="Horizontal">
                <TextBox x:Name="UrlContent" Width="250" HorizontalAlignment="Left" Text="{Binding NewMedia.UrlContent}" IsReadOnly="True" IsEnabled="{Binding IsAddingMovie}" />
                <jadeControls:ImageButton Width="20" Height="20" Source="/MediaBrowserSL.RIA;Component/Images/Movie.png" Margin="5,0,0,0" IsEnabled="{Binding IsAddingMovie}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <eventToCmd:OpenFileDialogBoxBehavior FileDialogDialogResultCommand="{Binding SelectedFileMovie, Mode=TwoWay}"
                                                                  DialogFilter="Fichiers Video|*.avi;*.mp4;*.mov"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </jadeControls:ImageButton>
            </StackPanel>

            <Border HorizontalAlignment="Left" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4" Grid.Column="1" Grid.Row="6" Width="220" Height="200">
                <Border.BorderBrush>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="Black" Offset="0"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Border.BorderBrush>

                <Image Stretch="Fill"  AllowDrop="{Binding IsAddingMovie}" Margin="1,1,1,1" Source="{Binding SelectedBitmapImageMovie}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Drop">
                            <eventToCmd:EventToCommand Command="{Binding DropPictureCommand}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Image>
            </Border>
        </Grid>
        
        <StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0" HorizontalAlignment="Right" VerticalAlignment="Top">
            <Grid>
                <Button x:Name="BtSave" Command="{Binding SaveMovieCommand}"   
                            Height="23" Width="98" HorizontalContentAlignment="Stretch" Margin="0,0,5,0">
                    <Grid>
                        <Image Source="/MediaBrowserSL.RIA;Component/Images/film_save.png" Width="16" Height="16" HorizontalAlignment="Left" Margin="1,0,0,0"/>
                        <sdk:Label Content="Sauvegarder" Margin="15,0,0,0" HorizontalAlignment="Center"/>
                    </Grid>
                </Button>
                <jadeControls:Loading IsLoading="{Binding IsSaving}" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Grid>

            <Button Height="23" Width="70" HorizontalContentAlignment="Stretch" Margin="0,0,5,0" Command="{Binding CloseCommand}">
                <Grid>
                    <Image Source="/MediaBrowserSL.RIA;Component/Images/cross.png" Width="16" Height="16" HorizontalAlignment="Left" Margin="1,0,0,0"/>
                    <sdk:Label Content="Annuler" Margin="15,0,0,0" HorizontalAlignment="Center"/>
                </Grid>
            </Button>
        </StackPanel>
    </Grid>
    
</customWindow:BlackStyleChildWindow>